bgo492134 - fix tilde expansion in GtkFileSystemUnix
authorFederico Mena Quintero <federico@gnu.org>
Wed, 2 Apr 2008 16:48:15 +0000 (16:48 +0000)
committerFederico Mena Quintero <federico@src.gnome.org>
Wed, 2 Apr 2008 16:48:15 +0000 (16:48 +0000)
Signed-off-by: Federico Mena Quintero <federico@gnu.org>
svn path=/trunk/; revision=19962

ChangeLog
gtk/gtkfilesystemunix.c

index ef994d56b383e0053548173fcff385a19d52df45..e7980f65b73a9d8e3722cf74c6391e51ac8c157e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2008-04-02  Federico Mena Quintero  <federico@novell.com>
+
+       Fix http://bugzilla.gnome.org/show_bug.cgi?id=492134 - The file
+       chooser incorrectly substitutes and expands a ~ when you type it
+       in the filename entry.
+
+       * gtk/gtkfilesystemunix.c (expand_tilde): Ensure that empty
+       basenames result in a slash-terminated pathname.
+       gtk_file_system_unix_parse() is correct, but it was splitting
+       "/home/username" into path="/home" and file_part="username", which
+       is not what the caller wants when the entry has just "~" or
+       "~username".
+
 2008-04-02  Tor Lillqvist  <tml@novell.com>
 
        * gtk/Makefile.am: Don't bother compiling gtksearchenginebeagle.c
index ad225afde72e415ff8a0be626d9affd20d0d8b7b..31387cbf76bb0e5528554b57b5b0f5a762b46005 100644 (file)
@@ -1470,10 +1470,11 @@ expand_tilde (const char *filename)
       home = passwd->pw_dir;
     }
 
+  /* We put G_DIR_SEPARATOR_S so that empty basenames will make the resulting path end in a slash */
   if (slash)
     return g_build_filename (home, G_DIR_SEPARATOR_S, slash + 1, NULL);
   else
-    return g_strdup (home);
+    return g_build_filename (home, G_DIR_SEPARATOR_S, NULL);
 }
 
 static gboolean